﻿using PLCS.Domain.Shared.Stations;
using PLCS.Domain.Stations;

namespace PLCS.Domain.Trays;

public class Tray : BaseEntity
{
    /// <summary>
    /// 工厂编码
    /// </summary>
    public string? SiteNo { get; set; }

    /// <summary>
    /// 车间编码
    /// </summary>
    public string? AreaNo { get; set; }

    /// <summary>
    /// 产线编码
    /// </summary>
    public string? PdLineNo { get; set; }

    /// <summary>
    /// 托盘编码
    /// </summary>
    public string TrayNo { get; init; }

    public Guid? StationId { get; set; }
    public Station? Station { get; set; }

    /// <summary>
    /// 托盘类型
    /// </summary>
    public TrayType TrayType { get; set; }

    /// <summary>
    /// 托盘状态
    /// </summary>
    public TrayStatus TrayStatus { get; private set; }

    /// <summary>
    /// 物料尺寸类型
    /// </summary>
    public int MaterialSize { get; set; }

    /// <summary>
    /// 是否有料
    /// </summary>
    public YesNo HaveStatus { get; set; }

    /// <summary>
    /// 当前物料号
    /// </summary>
    public string? MaterialNo { get; set; }

    /// <summary>
    /// 进入工位时间
    /// </summary>
    public DateTime? EnterTime { get; set; }

    private Tray()
    {
    }

    public Tray(string trayNo, TrayType trayType, int materialSize = 1)
    {
        TrayNo = trayNo;
        TrayType = trayType;
        MaterialSize = materialSize;
    }
}